package com.shangxia.dog.base.controller;


import com.shangxia.dog.base.entity.Menu;
import com.shangxia.dog.base.service.IMenuService;
import com.shangxia.dog.commom.vo.ResultVO;
import com.shangxia.dog.util.LoginUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 菜单表 前端控制器
 * </p>
 *
 * @author shangxia
 * @since 2022-01-21
 */
@RestController
@RequestMapping("/menu")
@Api(tags = "MenuController")
public class MenuController {

    @Autowired
    private IMenuService service;

    @ApiOperation(value = "获取菜单")
    @GetMapping("/listByAdminId")
    public ResultVO<List<Menu>> getMenuByAdminId() {
        return ResultVO.success(service.getMenuByAdminId(LoginUtil.getAdmin().getId()));
    }

}
